/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.usfirst.frc;
import edu.wpi.first.wpilibj.*;

/**
 *
 * @author James
 */
public class Roller extends ComponentFiber{
    private int state = 0;
    public void init() {
    }

    public void run() throws Throwable {
        if(Robot.driveStick.getRawButton(1)){ //Button Pressed
            switch(state){ //Change the button state
                case 0: //Button originally unpressed, normal mode
                    state = 3; //Switch to debug mode, pressed
                    break;
                case 1: //Button originally pressed, normal mode
                    break; // Do nothing
                case 2: //Button originally unpressed, debug mode
                    state = 1; // Switch to normal mode, pressed
                    break;
                case 3: //Button originally pressed, debug mode
                    break; //Do nothing
            }
        } else { //Button released
            switch(state){ //Change the button state
                case 0: //button originally unpressed, normal mode
                    break; // do nothing
                case 1: //Button originally presed, normal mode
                    state = 0; //Switch to unpressed, normal mode
                    break;
                case 2: //button originally unpressed, debug mode
                    break; // Do nothing
                case 3: // Button originally pressed, debug mode
                    state = 2; //Switch to unpressed, debug mode
                    break;
            }
        }
        if(state - 2 < 0)
            Robot.roller.set(1.0);
        else
            Robot.roller.set(0.0);
    }

    public void debugRun() throws Throwable {
    }

    public void popOut() throws Throwable{

    }
}
